UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WLBpWqT3RRfIfMiB8iAM8sSXAShAbcXlUZTeRnX55+8=' 
WHERE 
  key_id = '80d9b69e6694e00adbd298a343eb06aeb9b326e5c65b76c00bd594eabdacbac4' 
  AND (
    token = 'WLBpWqT3RRfIfMiB8iAM8sSXAShAbcXlUZTeRnX55+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065