UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UFMvqtw9NnrHxMM065lsRxJ1bb8T38D0vOpD4GZDuPY=' 
WHERE 
  key_id = '768431b8f12b04e7779c1f7ff8177f4231f6c641bb11685b8e39d23a158dabbf' 
  AND (
    token = 'UFMvqtw9NnrHxMM065lsRxJ1bb8T38D0vOpD4GZDuPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033