UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'noLxD5ooNCO/lmF8sualasfNsm2td1pntbh/VlqnGrU=' 
WHERE 
  key_id = '3ffe578dc64d2f6e63d224f06ff6168220c339bd772fb4d086f8cb432bf1052d' 
  AND (
    token = 'noLxD5ooNCO/lmF8sualasfNsm2td1pntbh/VlqnGrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046