UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lsQCNOu3AWinuVID9+zU6mb5SO1T4xAxkbh8VfUs6OQ=' 
WHERE 
  key_id = '4c74dd8fe3812b070a35bd824cd90f74351f0df9cdb82c8d4b37a45a8ae4e693' 
  AND (
    token = 'lsQCNOu3AWinuVID9+zU6mb5SO1T4xAxkbh8VfUs6OQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040