UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wqEdZAVKTeesisYu2s0CYmdIg7ONV/Vr6eK/++/QWcM=' 
WHERE 
  key_id = '2ff9d6960896d941eb460c4a322f1b67251dad4e6dd0f008dc8be15cb4040b8e' 
  AND (
    token = 'wqEdZAVKTeesisYu2s0CYmdIg7ONV/Vr6eK/++/QWcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038