UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sKLYLyveli1axJMgD2eGKizmi2i13X5TfnK2BO/ZufM=' 
WHERE 
  key_id = '254000387f4cb890432591886614d192ac97696ac8d0b09736b587ed1724331e' 
  AND (
    token = 'sKLYLyveli1axJMgD2eGKizmi2i13X5TfnK2BO/ZufM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030