UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S+8biCVueeihWbcjmd2wy5OhrBFdzcTe6twFFFpwcds=' 
WHERE 
  key_id = 'ef5f0a3b0d68b4ad5e5f52be10ca19c6582a33312a41a1eec867af063180211e' 
  AND (
    token = 'S+8biCVueeihWbcjmd2wy5OhrBFdzcTe6twFFFpwcds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030