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

Query time 0.00036