UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iIySiYByTmOp+PPUc9jxVYGl43h9d8SZz9u73fkjDxg=' 
WHERE 
  key_id = 'd811ba9956c283c5e368b5a570c35edbd91c492e6779de8b5af96eca701424be' 
  AND (
    token = 'iIySiYByTmOp+PPUc9jxVYGl43h9d8SZz9u73fkjDxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034