UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPrbjs7yWWhBOf1BXKghqGI5+FOfm72h5igZ369GV+I=' 
WHERE 
  key_id = 'bba8a245b917c577ebcd4a8f0439a76f8ffe0ef4ddb93b61e09bdf3effee68d9' 
  AND (
    token = 'xPrbjs7yWWhBOf1BXKghqGI5+FOfm72h5igZ369GV+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030