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

Query time 0.00038