UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dFuyfg2BcHlFsa3tZQ1N5HUumDdMtDfzYlFt+PUtMgk=' 
WHERE 
  key_id = '1d88699d2d97ee724324ba1cef03cb03be9812307d01d79dfc96fb99cde8f59d' 
  AND (
    token = 'dFuyfg2BcHlFsa3tZQ1N5HUumDdMtDfzYlFt+PUtMgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033