UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XXC8jjqxgjqoIJUYqd3OG5xchQS2QPBHnpwwyGZlFsU=' 
WHERE 
  key_id = 'cce2b7010d36f7766c098bed84b09d9573eb93737cef72c84a1119a7702a131c' 
  AND (
    token = 'XXC8jjqxgjqoIJUYqd3OG5xchQS2QPBHnpwwyGZlFsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050