UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'inE9dT0vB+NusuED3c8rrqG9a1uozrUzo+2gsyaPd8Y=' 
WHERE 
  key_id = '8346a089d696e677ca19868be5b2d7096a2538dc46c5bf7473a69077eec2c8bb' 
  AND (
    token = 'inE9dT0vB+NusuED3c8rrqG9a1uozrUzo+2gsyaPd8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033