UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n41o9+vFERPgShBLnXXFExGpBaK6sr0GEsxQeWQmFbY=' 
WHERE 
  key_id = 'c81c2c7efb9ca1fd0ee576d06bba3fa938d20dc683baaf2168cc9a24a5c26a9f' 
  AND (
    token = 'n41o9+vFERPgShBLnXXFExGpBaK6sr0GEsxQeWQmFbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031