UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mITR5tYLTb8deWqdBS3uWfNYqmURIdbrxGblPxOiyio=' 
WHERE 
  key_id = '36607218ad126976ee05bc4b1f5eb3b445493e941cb356ac69e8e5b7b690d4f7' 
  AND (
    token = 'mITR5tYLTb8deWqdBS3uWfNYqmURIdbrxGblPxOiyio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033