UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S2K61AEfgk5+A6SHoqg+yxQ7G0sP5UcBGUo7lmbA5tc=' 
WHERE 
  key_id = '9e00dcff787755967921a22060bed57fbab09f2fb3c528822c5913e6d8336cbd' 
  AND (
    token = 'S2K61AEfgk5+A6SHoqg+yxQ7G0sP5UcBGUo7lmbA5tc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037