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

Query time 0.00035