UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgyx8SGJbCtoYohtMSzQAOzXoR98OjVetLkZd1i81yI=' 
WHERE 
  key_id = '85ad983b70285169ed2b51c9f4178965b545aa9e8fb9070eeee71962e0fd9a03' 
  AND (
    token = 'wgyx8SGJbCtoYohtMSzQAOzXoR98OjVetLkZd1i81yI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029