UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/2PRgW7M4jAPQ5RQBXv3VxFoXFRmRjQrzAGAaKXg7Rg=' 
WHERE 
  key_id = '642fb93db8edebd9df40306b4ff207bda675cac94032a184825fc13551157b80' 
  AND (
    token = '/2PRgW7M4jAPQ5RQBXv3VxFoXFRmRjQrzAGAaKXg7Rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040