UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/x4S2xVgOnpny/r7imzDNpz3+XqDsV6WaB93jh3Lmc=' 
WHERE 
  key_id = '40f68d76c5b5415f4efdfbc9387e2654c87f0ea393b6f4c15d150c3f4e363fa5' 
  AND (
    token = 'm/x4S2xVgOnpny/r7imzDNpz3+XqDsV6WaB93jh3Lmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051