UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KcLOozj4IYLk0RvlQRqUNCcDmalxQx95tgBpy8Ifh+U=' 
WHERE 
  key_id = 'bf7a7632b34ab247b46a9f3321eefd795c5f78040bbe70bffe19ae714951a4d9' 
  AND (
    token = 'KcLOozj4IYLk0RvlQRqUNCcDmalxQx95tgBpy8Ifh+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036