UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WIiMiJVtDP4NE2X9FM+Zs7jLPIZPASCb3QOT2Yf2dZQ=' 
WHERE 
  key_id = '7caf0efab7938bba45956abc6376ed4db3b9beb31c7be07fe60dc96f0be26993' 
  AND (
    token = 'WIiMiJVtDP4NE2X9FM+Zs7jLPIZPASCb3QOT2Yf2dZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022