UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y3aGs36GGNulnMKpcT9dFXre4AYNEA0tgtHNYO679Jo=' 
WHERE 
  key_id = '3047415e732ccbe3f9171a9d72731320d6abfa67368dc4796553b036bdad21e6' 
  AND (
    token = 'y3aGs36GGNulnMKpcT9dFXre4AYNEA0tgtHNYO679Jo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033