UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nw2VcQVkqK3pKrVc3joP/VycR5RGDfJwT4YVFEfEXo4=' 
WHERE 
  key_id = 'cfb48878e85418ff4b141eae9078e50d83410f15b780716aeb1e099c42f3f68a' 
  AND (
    token = 'nw2VcQVkqK3pKrVc3joP/VycR5RGDfJwT4YVFEfEXo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032