UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XesDCpQhxu6GN0jrtNr3OGvJKe3BfOW77DnQuCU94s0=' 
WHERE 
  key_id = '54ae9ff3d131f4cfb3d1c10b30a96163a5fa0f54e4b2035815f7c16ba654e5b6' 
  AND (
    token = 'XesDCpQhxu6GN0jrtNr3OGvJKe3BfOW77DnQuCU94s0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029