UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQPcp9zZ/sfj5ivdIYwnzFQllMTvVk8dDvzke/w6wfA=' 
WHERE 
  key_id = '54005548fb1d12917ebdba69983fa2c373cf2b2710325f824a4a57ea9c42d017' 
  AND (
    token = 'KQPcp9zZ/sfj5ivdIYwnzFQllMTvVk8dDvzke/w6wfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029