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

Query time 0.00041