UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lkXry2P3BWWML2LUpHLousDPoQST+vmAWpwIvgpzMC8=' 
WHERE 
  key_id = 'f285eccee119d10be6efe35d03793ffb4b0c43ed1a8df933e97db08f8ae4f21c' 
  AND (
    token = 'lkXry2P3BWWML2LUpHLousDPoQST+vmAWpwIvgpzMC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039