UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oX8bkgTUUI9d+C4jbo22n15NLa9ZAwfVDBahwu9a0yw=' 
WHERE 
  key_id = '3f979b491c4f94ade0559adcdf29542b7ef07a4e71a4c8e8229c9ad5130a5a8f' 
  AND (
    token = 'oX8bkgTUUI9d+C4jbo22n15NLa9ZAwfVDBahwu9a0yw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050