UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1w/c9/1ypj7S7cKJWz8pFuVgCf5DvHb3UPRDEZB3oZE=' 
WHERE 
  key_id = 'de1c89b61f8b45fe9cd6b636e191954900c41245ee1c922248b748d489795e2b' 
  AND (
    token = '1w/c9/1ypj7S7cKJWz8pFuVgCf5DvHb3UPRDEZB3oZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035