UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYI8BWhaID9Pwaz6xVhvYHZ14uSbo0uKUCiu49Kgsqs=' 
WHERE 
  key_id = '25276ed692f8f6c2b8e30b89ee608e0a76baefd324d8b44558191ebbc0ef3085' 
  AND (
    token = 'aYI8BWhaID9Pwaz6xVhvYHZ14uSbo0uKUCiu49Kgsqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018