UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6xXyYOccOIMYO6DvW5SorruX8B3zTOSEf9BxDb0jfM=' 
WHERE 
  key_id = '745cd78284f49f4642cdf329e4afafa09cfe745fece374c2869cdfeb8728694e' 
  AND (
    token = 'G6xXyYOccOIMYO6DvW5SorruX8B3zTOSEf9BxDb0jfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022