UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5p6e+OoZR0zvgATWaWBpI22X8sT3ZIGmM5/e7fxaYmA=' 
WHERE 
  key_id = '169db09cdb049c1e0c34e2c5fd2bb33455d34c4002a7a6ca87cd81b767691500' 
  AND (
    token = '5p6e+OoZR0zvgATWaWBpI22X8sT3ZIGmM5/e7fxaYmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034