UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OUn4zuL7jYYDwExvbMUbn46PtnraYDz5xiS4UsOnEj0=' 
WHERE 
  key_id = '47740b558967742f405789007b4702e2d9a37c2e559c30f68cb189b2b408e106' 
  AND (
    token = 'OUn4zuL7jYYDwExvbMUbn46PtnraYDz5xiS4UsOnEj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060