UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'coa0Lk02mc7JcdjnbHc7hUJUrpAVzbmQeoL2m+2HAGw=' 
WHERE 
  key_id = '3614fe88a9ebad311157cb1ffb7aa72b21cd0eb9e8e5fce7c871944decd33b27' 
  AND (
    token = 'coa0Lk02mc7JcdjnbHc7hUJUrpAVzbmQeoL2m+2HAGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032