UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c0QLg9kqzRLaGW5nqHtoC46JhG0Up4/dZ5Zhqda3rgM=' 
WHERE 
  key_id = 'cdfb196adcf2cee4908cba37b0245a06e3fdbcc207d619be278058157beaf6ea' 
  AND (
    token = 'c0QLg9kqzRLaGW5nqHtoC46JhG0Up4/dZ5Zhqda3rgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039