UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKL2K3Tsg7HREwhdZw+naT00Ctl0KyCcXRD946H//VM=' 
WHERE 
  key_id = '682edf5bcdbd5e994a2e862f9b45708bc68818481392cd19be484d092a08009e' 
  AND (
    token = 'yKL2K3Tsg7HREwhdZw+naT00Ctl0KyCcXRD946H//VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055