UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FZuXw4KnfWouUKxe75l4T3TAoJh+ELxZ8Edl2uwzOtA=' 
WHERE 
  key_id = 'ea74e5b51fe403c0a16f0c29961983031965d370b09c8c6f09231c7b2c7e5430' 
  AND (
    token = 'FZuXw4KnfWouUKxe75l4T3TAoJh+ELxZ8Edl2uwzOtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036