UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fdfWtEUsb+zrpClKBdqbTfi2if9K5ebFDm51AY1Y/hc=' 
WHERE 
  key_id = '6b2f979796995dcaeaf5937a14d515e26382a89d21e0abb377bcd5f97122f334' 
  AND (
    token = 'fdfWtEUsb+zrpClKBdqbTfi2if9K5ebFDm51AY1Y/hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032