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

Query time 0.00022