UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LNtyXvcvvclbfMxkuvXSE82Cd1AqAwH2dHX9ClhdD9s=' 
WHERE 
  key_id = '730d81607b9309607c4c0a8d899a4d17e30f9eead44da08700021ca02dca2dc6' 
  AND (
    token = 'LNtyXvcvvclbfMxkuvXSE82Cd1AqAwH2dHX9ClhdD9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047