UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zrKdE5+n9XLHPAUgQyX+r+J0BB4FUkhGH2noTm2d+Kc=' 
WHERE 
  key_id = '722332b5bfbe5907cd085c3cbfb1f5870b5be02f58812a862b25bd14c2cd2452' 
  AND (
    token = 'zrKdE5+n9XLHPAUgQyX+r+J0BB4FUkhGH2noTm2d+Kc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035